package com.three.lab.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.three.lab.R;
import com.three.lab.bean.ChatBean;

import java.util.List;

public class ServiceMsgAdapter extends BaseMultiItemQuickAdapter<ChatBean, BaseViewHolder> {

    private static final int FROM_ME = 1;
    private static final int FROM_OTHER = 2;

    public ServiceMsgAdapter( @Nullable List<ChatBean> data) {
        super(data);
        addItemType(FROM_ME,R.layout.item_list_chat_self);
        addItemType(FROM_OTHER,R.layout.item_list_chat_other);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ChatBean item) {
        switch (helper.getItemViewType()){
            case FROM_ME:
                helper.setText(R.id.tv_chat_self,item.getContent());
                break;
            case FROM_OTHER:
                helper.setText(R.id.tv_chat_other,item.getContent());
                break;
        }
    }
}
